<?php
/**
 * LaundryUpdateMsgtpl智能洗衣中间服务器异步回调处理后发送消息模版
 * @author hjc19850430@gmail.com
 */
class LaundryUpdateMsgtpl extends BaseMsgtpl
{
	/**
	 *发消息给管理员
	 */
	public function sendMessageToManage($tasks){
		session('account_id',16);
		session('wechat_id',16);

		$website=D('LaundryWebsite')->get($tasks['website_id']);
		$terminal=D('LaundryTerminal')->get($tasks['terminal_id']);
		$this->wxTplSign = 'JEIHcpB88aO3Hom8kXBAxbJmnN0Yflb5fKI7vJXLspY';
		
		if($tasks['type']==1){
			$code="管理员您好，刚刚执行合闸指令作失败，请核实处理\n";
			$type='合闸';
		}elseif($tasks['type']==2){
			$code="管理员您好，刚刚执行拉闸指令作失败，请核实处理\n";
			$type='拉闸';
		}
		$info = array(
			'first' => array("value" => $code),
			'keyword1' => array("value" => date('Y-m-d H:i:s')),
			'keyword2' => array("value" => '智能洗衣'.$type.'异常'),
			'remark' => array("value" => "网点编号：".$website['website_name']."\n线下编号：".$terminal['line_num']."\n电表编号：".$tasks['terminal_code']."\n可能原因：".$tasks['fail_reason']."\n请前往后台核实处理\n"),
		);
		
		$res = $this->wxObj->messageTpl('wxb54fa7ff735ec8c1', 'a4778ec753785812aeafd78d6efd88d9', 'oZTBst0CuhTktQZSRbIs8K5hVHSg', $template_id, $info);//CXD
		$res = $this->wxObj->messageTpl('wxb54fa7ff735ec8c1', 'a4778ec753785812aeafd78d6efd88d9', 'oZTBst1n4C-GhWBmWHyzSSkiPcZM', $template_id, $info);//CH
		$res = $this->wxObj->messageTpl('wxb54fa7ff735ec8c1', 'a4778ec753785812aeafd78d6efd88d9', 'oZTBstzl4r4fyYTWKnMbKe8jWLHg', $template_id, $info);//LX
		return $res;
	}
}
